One of a processor's functions is to perform arithmetic operations on numerical data. When the input data for these operations are integers in the American Standard Code for Information Interchange (ASCII) format, a conversion to a binary decimal format is often performed. This is desirable from a space and time efficiency point of view, since, in the ASCII format, each number, zero to nine that, together, comprise the integer, is represented by eight bits (seven bits for the number representation and one bit for parity). Thus, eight bits would be able to represent an integer of zero to one hundred twenty seven plus a sign bit in a binary decimal format, but only an integer of zero to nine in an ASCII format; sixteen bits would be able to represent an integer from zero to thirty two thousand seven hundred sixty seven plus a sign bit, but only an integer from zero to ninety nine in the ASCII format; and n bits (where n equals an integer greater than zero) would be able to represent an integer from zero to (two to the power of (n plus one)) minus one, but only an integer from zero to nine for n equals one, zero to ninety nine for n equals two, zero to nine hundred ninety nine for n equals three, etc.
Methods for conversion from ASCII to binary decimal within a processor are known. These methods include identifying the beginning, ending, and sign of the integer ASCII string followed by taking each of the seven bit components of the integer one at a time, usually starting with the least significant digit and subtracting the binary number forty eight to get the decimal numbers that make up the integer. Then each of the decimal components of the integer are multiplied by a power of ten, starting with ten to the zero power, or 1, for the least significant digit, ten to the first power, or 10, for the digit to the left of the least significant digit, if applicable, ten to the second power, or 100, for the digit to the left of the previous digit, if applicable, etc. This is repeated for as many digits comprising the integer, up to and including the most significant digit. Each of these products is then aggregated and the sign added, resulting in the converted number.
One problem with this technique is that the time for conversion will vary, becoming longer as the size of the ASCII integer string increases. Another problem with the prior art is that the code for performing the conversion function involves branching in the instruction stream, also adding to the execution time and efficiency of the conversion.